<?php
$buzzr_cities = get_buzzr_cities();
$city = pods_url_variable('1'); 
$city_url = BUZZR_URL.'/localoffers/'.$city;
$cat_slug = pods_url_variable('last');
$cat_pod_item = new Pod('category', $cat_slug);
$cat_name = ucwords($cat_pod_item->get_field('name'));
$cat_link = BUZZR_URL.'/'.$cat_slug;
$list_view_deal = new Pod('deal');
$where = "t.camp_end > ".fix_date()." && t.dealcheck='0' && camp_cat.url='".$cat_slug."' && t.sale='1' && city.name='".$city."'";
$list_view_deal->findRecords("id DESC", 15, $where);
?>
<div class="breadcrumb">
<ul>
       <li><a href="<?php echo BUZZR_URL; ?>" title="Buzzr.in">Home</a> >></li>
       <li><a href="<?php echo $city_url; ?>" title="<?php echo $city; ?>" ><?php echo ucwords($city); ?></a> >></li>
       <li><a href="<?php /*echo $cat_link;*/ ?>" title="<?php echo $cat_name.' Offers'; ?>" ><?php echo $cat_name.' Offers'; ?></a> >></li>
</ul>
</div>
<div class="clear"></div>
<h1 id="f_margin"><?php echo ucwords($city).' '.$cat_name.' Offers'; ?></h1>
<?php buzzr_fb_like(); ?>
<div class="clear"></div>
<div class="filter">
 <div class="city_select">Select City
	 <select name="city_select" onchange="window.location.href = this.value;">
	 	<option value="#">-- Choose City --</option>
	 	<?php foreach($buzzr_cities as $city_val){
           $citlink = BUZZR_URL.'/localoffers/'.strtolower($city_val['name']);
        ?>
          <?php if(ucwords($city) == $city_val['name']){ ?>
           <option value="<?php echo $citlink; ?>" selected="selected"><?php echo $city_val['name']; ?></option>
           <?php }else{ ?>
	 	<option value="<?php echo $citlink; ?>"><?php echo $city_val['name']; ?></option>
	 	<?php }
	 	} 
	 	?>
	 </select>
  </div> 
  <div class=views>
	<a class="grid g-button">Map View</a>
	<a class="list g-button">List View</a>
  </div>
  <div class="sort">Sort by
	<a class="g-button" href="<?php echo BUZZR_URL.'/deals'; ?>">Latest</a>
	<a class="g-button" href="<?php echo BUZZR_URL.'/deals-popular'; ?>">Popular</a>
  </div>
  <div class="clear"></div>
</div>

<div id="list_wrap">
<ul class="list">

<?php echo $list_view_deal->showTemplate('list_grid'); ?>

</ul>
</div>

<div class="clear"></div>
<div>
<?php echo $list_view_deal->getPagination(); ?>
</div>

<div id="map_wrap">

<div id="deals_map">
  <div id="deals_map_wrap"></div>
</div>
<div id="map_canvas"></div>
<div id="details"></div>
<div id="spinner"><img src="<?php echo BUZZR_THEME_URL.'/img/buzzr_spinner.gif'; ?>" /></div>
<div id="tags-control" class="gradient">
<label for="tags">Filter Category</label>
<select id="tags">

</select>          
</div>
<div id="search" class="gradient">
   <label for="address">Search</label>
   <input type="text" id="address" value="(Area, City) or (City)" />
   <input type="button" id="address_go" value="Go" />
</div>

</div>
<div class="clear"></div>